package com.wolf.etl.core.filter;

import com.wolf.util.StringUtils;
import com.wolf.vo.BaseResult;
import org.springframework.stereotype.Component;

/**
 * @author sdyang
 * @date 2019/10/13 17:58
 **/
@Component("eQUAL")
public class EQUAL extends AbstractFilter{
    @Override
    public BaseResult filter(String columnName, String... value) {
        String filterStr = "";
        if(StringUtils.isNumeric(value[0])) {
             filterStr = String.format(" and %s=%s", columnName, value[0]);
        }else{
            filterStr = String.format(" and %s='%s'", columnName, value[0]);
        }
        BaseResult result = BaseResult.getSuccess(filterStr);
        return result;
    }
}
